import { getFormatterPrice } from '@const/filter'
// 通用-产品大类
export const categoryArr = {
  1: '高值',
  2: '低值',
  3: '试剂',
  4: '设备',
  5: '器械'
}
// 后结算订单状态
// 订单状态orderStatus: 0-全部，11-待配送商响应，12-待配送商发货，13-待收货，14-收货完成，15-已撤消，16-已拒绝
export const statusArr = {
  0: '全部',
  11: '待配送商响应',
  12: '待配送商发货',
  13: '待收货',
  14: '收货完成',
  15: '已撤销',
  16: '已拒绝'
}

// 主列表页--搜索项
export const indexSearchData = [
  {
    key: 'purchaseOrderCode',
    title: '采购单号', // 1
    type: 'input',
    attr: {
      placeholder: '请输入'
    }
  },
  {
    key: 'relationOrderCode',
    title: '关联订单号',
    type: 'input',
    attr: {
      placeholder: '请输入' // 1
    }
  },
  {
    key: 'settleStartTime',
    title: '结算日期',
    type: 'time',
    fieldname: ['settleBeginDate', 'settleEndDate'],
    attr: {
      style: 'width:270px !important;',
      class: 'daterange',
      type: 'daterange',
      'start-placeholder': '开始时间',
      'end-placeholder': '结束时间',
      'default-time': ['00:00:00', '23:59:59']
    }
  },
  {
    key: 'applyDept',
    title: '申请科室',
    type: 'input',
    attr: {
      placeholder: '请输入' // 1
    }
  },
  {
    key: 'distributorName',
    title: '配送商',
    type: 'input',
    attr: {
      placeholder: '请输入'
    }
  },
  {
    key: 'startTime',
    title: '创建时间',
    type: 'time',
    fieldname: ['beginDate', 'endDate'],
    attr: {
      style: 'width:270px !important;',
      class: 'daterange',
      type: 'daterange',
      'start-placeholder': '开始时间',
      'end-placeholder': '结束时间',
      'default-time': ['00:00:00', '23:59:59']
    }
  }
]
// 主列表页-tab项
// 订单状态orderStatus: 0-全部，11-待配送商响应，12-待配送商发货，13-待收货，14-收货完成，15-已撤消，16-已拒绝
export const indexTabsArr = [
  { lab: '待配送商响应', val: 11, badge: { value: null } }, // 1
  { lab: '待配送商发货', val: 12, badge: { value: null } }, // 1
  { lab: '待收货', val: 13, badge: { value: null } },
  { lab: '收货完成', val: 14, badge: { value: null } },
  { lab: '已撤销', val: 15, badge: { value: null } },
  { lab: '已拒绝', val: 16, badge: { value: null } }, // 1
  { lab: '全部', val: 0, badge: { value: null } }
]
// 主列表页--列表表头
export const indexTableData = [
  // { type: 'index', label: '序号', width: 60 },
  { prop: 'purchaseOrderCode', label: '采购单号', width: 170, 'show-overflow-tooltip': true }, // 1
  { prop: 'relationOrderCode', label: '关联订单号', width: 170, 'show-overflow-tooltip': true }, // 1
  { prop: 'settleDate', label: '结算日期', width: 120 },
  { prop: 'applyDept', label: '申请科室', width: 170 }, // 1
  { prop: 'prodTypeCount', label: '品种数', width: 150 }, // 1
  { prop: 'prodTotalCount', label: '产品数量', width: 150 }, // 1
  // { prop: 'orderCode', label: 'M平台订单编号', width: 170 },
  { prop: 'orderAmount', label: '订单金额（元）', width: 150, formatter: row => getFormatterPrice(row.orderAmount) },
  { prop: 'relationOrderAmount', label: '已关联发票金额（元）', width: 170, formatter: row => getFormatterPrice(row.relationOrderAmount) },
  { prop: 'receiveAddress', label: '收货地址', width: 150, 'show-overflow-tooltip': true },
  { prop: 'contacts', label: '联系人', width: 150 },
  { prop: 'contactNumber', label: '联系电话', width: 150 },
  { prop: 'distributorName', label: '配送商', 'min-width': 170, 'show-overflow-tooltip': true },
  { prop: 'createTime', label: '创建时间', width: 150 },
  { prop: 'orderStatus',
    label: '订单状态',
    width: 150,
    formatter: row => {
      return statusArr[row.orderStatus]
    } },
  // { prop: 'hospitalOrderCode', label: '医院订单编号', width: 150 },
  { prop: 'action', label: '操作', width: 100, fixed: 'right' }
]

// 收货页-列表搜索项
export const purchaseSearchData = [
  {
    key: 'invoiceNo',
    title: '发票号', // 1
    type: 'input',
    attr: {
      placeholder: '请输入',
      size: 'mini'
    }
  },
  {
    key: 'prodCode',
    title: '产品编码',
    type: 'input',
    attr: {
      placeholder: '请输入', // 1
      size: 'mini'
    }
  },
  {
    key: 'prodName',
    title: '产品名称',
    type: 'input',
    attr: {
      placeholder: '请输入',
      size: 'mini'
    }
  },
  {
    key: 'registNo',
    title: '注册证/备案证号',
    type: 'input',
    attr: {
      placeholder: '请输入',
      size: 'mini'
    }
  },
  {
    key: 'prodBatchNo',
    title: '批号',
    type: 'input',
    attr: {
      placeholder: '请输入',
      size: 'mini'
    }
  },
  {
    key: 'prodManufacturer',
    title: '生产厂家',
    type: 'input',
    attr: {
      placeholder: '请输入',
      size: 'mini'
    }
  }
]
// 收货页--列表表头
export const purcharseReceiveTableData = [
  // { type: 'index', label: '序号', width: 60 },
  { prop: 'invoiceAction', label: '发票详情', width: 100 },
  { prop: 'invoiceNo', label: '发票号', width: 170, 'show-overflow-tooltip': true },
  { prop: 'invoiceUrl', label: '发票影像', width: 90 },
  { prop: 'count', label: '收货数量', width: 170, 'show-overflow-tooltip': true },
  { prop: 'productDate', label: '生产日期（11）', width: 170, 'show-overflow-tooltip': true },
  { prop: 'expDate', label: '失效日期（17）', width: 170, 'show-overflow-tooltip': true },
  { prop: 'productBatch', label: '批号（10）', width: 170, 'show-overflow-tooltip': true },
  { prop: 'serialNumber', label: '序列号（21）', width: 170, 'show-overflow-tooltip': true },
  { prop: 'udi', label: 'UDI', width: 170, 'show-overflow-tooltip': true },
  { prop: 'purchaseDetailCode', label: '采购明细单号', width: 170, 'show-overflow-tooltip': true },
  // { prop: 'receiveDetailCode', label: '收货明细单号', width: 170, 'show-overflow-tooltip': true },
  { prop: 'relationDetailCode', label: '关联明细单号', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodCode', label: '产品编码', width: 150 },
  { prop: 'prodName', label: '产品名称', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodSpecs', label: '规格', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodModel', label: '型号', width: 150, 'show-overflow-tooltip': true },
  { prop: 'minUnit', label: '最小单位', width: 150 },
  { prop: 'unitPrice', label: '单价（元）', width: 120, formatter: row => getFormatterPrice(row.unitPrice) },
  { prop: 'registrationNumber', label: '注册证号/备案证号', width: 170, 'show-overflow-tooltip': true },
  { prop: 'manufacturer', label: '生产厂家', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodBigCategory',
    label: '产品大类',
    width: 90,
    formatter: row => {
      return categoryArr[row.ProdBigCategory]
    }
  },
  { prop: 'purchaseCount', label: '采购数量', width: 150, 'show-overflow-tooltip': true },
  { prop: 'detailAmount', label: '采购金额(元)', width: 120, formatter: row => getFormatterPrice(row.detailAmount) }
]

// 详情页-订单信息表头
export const partOrderColumns = [
  { prop: 'purchaseDetailCode', label: '采购明细单号', width: 150, 'show-overflow-tooltip': true }, // 1
  { prop: 'relationDetailCode', label: '关联明细单号', width: 150, 'show-overflow-tooltip': true }, // 1
  { prop: 'prodCode', label: '产品编码', width: 150, 'show-overflow-tooltip': true }, // 1
  { prop: 'prodName', label: '产品名称', width: 150, 'show-overflow-tooltip': true }, // 1
  { prop: 'prodSpecs', label: '规格', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodModel', label: '型号', width: 150, 'show-overflow-tooltip': true },
  { prop: 'minUnit', label: '最小单位', width: 150 },
  { prop: 'price', label: '采购价格 （元）', width: 150, formatter: row => getFormatterPrice(row.price) },
  { prop: 'registrationNumber', label: '注册证号/备案证号', width: 170, 'show-overflow-tooltip': true },
  { prop: 'manufacturer', label: '生产厂家', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodBigCategory',
    label: '产品大类',
    width: 150,
    formatter: row => {
      return categoryArr[row.prodBigCategory]
    } },
  { prop: 'purchaseCount', label: '采购数量', width: 150 },
  { prop: 'detailAmount', label: '采购金额 （元）', width: 150, formatter: row => getFormatterPrice(row.detailAmount) }
]
// 详情页 - 收货基础信息2
export const receiptDetailsForm = [
  { key: 'inStockCode', title: '收货单号' },
  { key: 'inStockObjCode', title: '收货时间' },
  { key: 'createdAt', title: ' 收货人' }
]

// 详情页--tab项
export const detailTabsArr = [
  { lab: '订单信息', val: 0, disabled: null },
  { lab: '收货信息', val: 1, disabled: null }
]
// 详情页/收货页--基本信息
export const purcharseCommonForm = [
  [
    { key: 'purchaseOrderCode', label: '采购单号' }, // 1
    { key: 'relationOrderCode', label: '关联订单号' }, // 1
    { key: 'orderStatus', label: '订单状态' } // 1
  ],
  [
    { key: 'createDate', label: '创建时间' }, // 1
    { key: 'distributorName', label: ' 配送商' }, // 1
    { key: 'settleDate', label: ' 结算日期' } // 1
  ],
  [
    { key: 'applyDept', label: '申请科室' },
    { key: 'receiveAddress', label: '收货地址' },
    { key: 'contacts', label: '联系人' }
  ],
  [
    { key: 'contactNumber', label: '联系电话' }
  ]
]
// 详情页 - 收货信息表头 暂时和待收货详情一样
export const partReceiveGoodsColumns = [
  // { type: 'index', label: '序号', width: 60 },
  { prop: 'invoiceAction', label: '发票详情', width: 100 },
  { prop: 'invoiceNo', label: '发票号', width: 170, 'show-overflow-tooltip': true },
  { prop: 'invoiceUrl', label: '发票影像', width: 90 },
  { prop: 'count', label: '收货数量', width: 170, 'show-overflow-tooltip': true },
  { prop: 'productDate', label: '生产日期（11）', width: 170, 'show-overflow-tooltip': true },
  { prop: 'expDate', label: '失效日期（17）', width: 170, 'show-overflow-tooltip': true },
  { prop: 'productBatch', label: '批号（10）', width: 170, 'show-overflow-tooltip': true },
  { prop: 'serialNumber', label: '序列号（21）', width: 170, 'show-overflow-tooltip': true },
  { prop: 'udi', label: 'UDI', width: 170, 'show-overflow-tooltip': true },
  // { prop: 'purchaseDetailCode', label: '采购明细单号', width: 170, 'show-overflow-tooltip': true },
  { prop: 'receiveDetailCode', label: '收货明细单号', width: 170, 'show-overflow-tooltip': true },
  { prop: 'relationDetailCode', label: '关联明细单号', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodCode', label: '产品编码', width: 150 },
  { prop: 'prodName', label: '产品名称', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodSpecs', label: '规格', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodModel', label: '型号', width: 150, 'show-overflow-tooltip': true },
  { prop: 'minUnit', label: '最小单位', width: 150 },
  { prop: 'unitPrice', label: '单价（元）', width: 120, formatter: row => getFormatterPrice(row.unitPrice) },
  { prop: 'registrationNumber', label: '注册证号/备案证号', width: 170, 'show-overflow-tooltip': true },
  { prop: 'manufacturer', label: '生产厂家', width: 150, 'show-overflow-tooltip': true },
  { prop: 'prodBigCategory',
    label: '产品大类',
    width: 90,
    formatter: row => {
      return categoryArr[row.ProdBigCategory]
    }
  },
  { prop: 'purchaseCount', label: '采购数量', width: 150, 'show-overflow-tooltip': true },
  { prop: 'detailAmount', label: '采购金额(元)', width: 120, formatter: row => getFormatterPrice(row.detailAmount) }
]
